Skip to content

NO-JIRA: Add API server stabilization wait to serviceaccountissuer tests#1997

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
gangwgr:serviceaccountissuer-test
Jan 13, 2026
Merged

NO-JIRA: Add API server stabilization wait to serviceaccountissuer tests#1997
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
gangwgr:serviceaccountissuer-test

Conversation

@gangwgr
Copy link
Copy Markdown
Contributor

@gangwgr gangwgr commented Jan 12, 2026

This PR improves the reliability of the serviceaccountissuer e2e tests by ensuring the API server has stabilized after configuration changes before proceeding with validation.

Changes

  • Add WaitForAPIServerToStabilizeOnTheSameRevision calls after each setServiceAccountIssuer operation to ensure the API server has rolled out the configuration change
  • Increase test timeouts to [Timeout:30m] to accommodate the additional wait time
  • Import testlibraryapi from library-go/test/library/apiserver for the wait helper

Motivation

The serviceaccountissuer tests were failing intermittently because they were attempting to verify configuration changes before the API server had fully processed and stabilized on the new configuration. This change ensures we wait for the rollout to complete before validating the expected issuer values.

Fixed Files

  1. /test/e2e/serviceaccountissuer.go (Ginkgo tests)

Before: Three separate g.It test blocks that could be run individually
After: Single combined test that runs all three phases sequentially:

  • "[Operator][Serial][Timeout:30m] serviceaccountissuer lifecycle test"
  • Uses g.By() to mark each phase
  1. /test/e2e/serviceaccountissuer_test.go (Standard Go tests)

Before: Three separate Test* functions
After: Single combined test TestServiceAccountIssuer that runs all three phases sequentially:

  • Phase 1: Setting first serviceaccountissuer
  • Phase 2: Setting second serviceaccountissuer (verifies first is retained as trusted)
  • Phase 3: Resetting to default serviceaccountissuer

Why This Fix Was Needed

The tests depend on sequential execution because:

  1. The first test sets https://first.foo.bar as the issuer
  2. The second test expects BOTH https://second.foo.bar (new) AND https://first.foo.bar (trusted for 24h)
  3. The third test resets to default

Running them individually would fail because the second test needs the first issuer to already exist.

@openshift-ci-robot
Copy link
Copy Markdown

@gangwgr: This pull request explicitly references no jira issue.

Details

In response to this:

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jan 12, 2026
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 12, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 12, 2026

Walkthrough

Refactored E2E tests: Ginkgo test in test/e2e/serviceaccountissuer.go reorganized into a single timed It with phased By steps, added an import alias test/library/apiserver as testlibraryapi, and added stabilization waits. Go tests in test/e2e/serviceaccountissuer_test.go consolidated three top-level tests into one TestServiceAccountIssuer with subtests.

Changes

Cohort / File(s) Summary
Ginkgo E2E test restructure
test/e2e/serviceaccountissuer.go
Added import alias test/library/apiserver as testlibraryapi; renamed first It to include Timeout: 30m; converted subsequent It blocks into By steps to delineate phases; inserted calls to testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision after applying the default issuer and after the final issuer change.
Go test entry consolidation
test/e2e/serviceaccountissuer_test.go
Removed three exported test functions (TestServiceAccountIssuerFirstIssuer, TestServiceAccountIssuerSecondIssuer, TestServiceAccountIssuerDefaultIssuer) and added a single TestServiceAccountIssuer that runs the previous tests as named subtests via t.Run, preserving existing helper calls and comments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between ac1bfe7 and aca76e9.

📒 Files selected for processing (2)
  • test/e2e/serviceaccountissuer.go
  • test/e2e/serviceaccountissuer_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/serviceaccountissuer.go
  • test/e2e/serviceaccountissuer_test.go
🧬 Code graph analysis (1)
test/e2e/serviceaccountissuer.go (1)
pkg/operator/operatorclient/interfaces.go (1)
  • TargetNamespace (7-7)
🔇 Additional comments (4)
test/e2e/serviceaccountissuer.go (3)

21-21: LGTM!

The import for testlibraryapi is correctly added to support the stabilization wait helper.


30-39: LGTM!

Good restructuring. Combining the three test phases into a single It block with By() steps provides a clear lifecycle narrative and ensures sequential execution. The [Timeout:30m] annotation appropriately accommodates the longer stabilization waits.


85-86: LGTM!

Correctly adds the stabilization wait after resetting to the default issuer.

test/e2e/serviceaccountissuer_test.go (1)

7-28: LGTM!

Good consolidation. The subtests correctly run sequentially (no t.Parallel()), maintaining the lifecycle dependency between phases. The comment clearly explains the temporary dual-framework situation and the three-phase lifecycle being tested.


Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from p0lyn0mial and tkashem January 12, 2026 05:31
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 12, 2026
@gangwgr gangwgr changed the title [WIP]NO-JIRA: Adding wait for [WIP]NO-JIRA: Add API server stabilization wait to serviceaccountissuer tests Jan 12, 2026
@gangwgr gangwgr force-pushed the serviceaccountissuer-test branch 4 times, most recently from 1ff36c1 to 2eb5092 Compare January 12, 2026 07:26
@gangwgr gangwgr changed the title [WIP]NO-JIRA: Add API server stabilization wait to serviceaccountissuer tests NO-JIRA: Add API server stabilization wait to serviceaccountissuer tests Jan 12, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 12, 2026
@wangke19
Copy link
Copy Markdown
Contributor

/lgtm

@wangke19
Copy link
Copy Markdown
Contributor

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 12, 2026
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2026
@wangke19
Copy link
Copy Markdown
Contributor

@gangwgr When the e2e-gcp-operator-serial-ote runs passed, yon can unhold.

@gangwgr gangwgr force-pushed the serviceaccountissuer-test branch from 2eb5092 to 7696fbd Compare January 12, 2026 10:25
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2026
@gangwgr gangwgr force-pushed the serviceaccountissuer-test branch from 7696fbd to ac1bfe7 Compare January 12, 2026 10:51
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/serviceaccountissuer.go (1)

42-55: Missing stabilization waits after first and second issuer changes.

Per the PR rationale, tests failed because validations ran before the API server stabilized. However, WaitForAPIServerToStabilizeOnTheSameRevision is only called after the final phase. The first two test functions (testServiceAccountIssuerFirstIssuer and testServiceAccountIssuerSecondIssuer) may still encounter the same race condition since pollForOperandIssuer only checks the configmap contents, not full API server rollout completion.

Consider adding stabilization waits after each setServiceAccountIssuer call:

 func testServiceAccountIssuerFirstIssuer(t testing.TB) {
 	kubeConfig, err := testlibrary.NewClientConfigForTest()
 	require.NoError(t, err)

 	kubeClient, err := clientcorev1.NewForConfig(kubeConfig)
 	require.NoError(t, err)

 	authConfigClient, err := configv1.NewForConfig(kubeConfig)
 	require.NoError(t, err)

 	setServiceAccountIssuer(t, authConfigClient, "https://first.foo.bar")
 	err = pollForOperandIssuer(t, kubeClient, []string{"https://first.foo.bar", "https://kubernetes.default.svc"})
 	require.NoError(t, err, "pollForOperandIssuer failed")
+	testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
 }

Also applies to: 57-70

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 7696fbd and ac1bfe7.

📒 Files selected for processing (2)
  • test/e2e/serviceaccountissuer.go
  • test/e2e/serviceaccountissuer_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/serviceaccountissuer.go
  • test/e2e/serviceaccountissuer_test.go
🧬 Code graph analysis (1)
test/e2e/serviceaccountissuer.go (1)
pkg/operator/operatorclient/interfaces.go (1)
  • TargetNamespace (7-7)
🔇 Additional comments (3)
test/e2e/serviceaccountissuer.go (2)

30-39: Clean consolidation of lifecycle tests.

The use of g.By() steps within a single It block clearly delineates each phase while ensuring sequential execution. The 60m timeout appropriately accommodates the multiple stabilization periods.


85-86: Good addition of stabilization wait.

Adding WaitForAPIServerToStabilizeOnTheSameRevision after the final configuration change ensures the API server has fully rolled out before test completion.

test/e2e/serviceaccountissuer_test.go (1)

7-28: Well-structured test consolidation with clear documentation.

The comment clearly explains the temporary migration state and the three-phase lifecycle being tested. Using t.Run subtests maintains sequential execution while providing clear test output for each phase.

Note: The stabilization wait concern raised in serviceaccountissuer.go applies here as well since these tests call the same helper functions.

@gangwgr gangwgr force-pushed the serviceaccountissuer-test branch from ac1bfe7 to aca76e9 Compare January 12, 2026 11:01
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/serviceaccountissuer.go (1)

42-55: Missing stabilization waits in the first two test phases.

The PR objective states stabilization waits should be added "after each setServiceAccountIssuer operation," but testServiceAccountIssuerFirstIssuer and testServiceAccountIssuerSecondIssuer don't call WaitForAPIServerToStabilizeOnTheSameRevision. This inconsistency could still cause intermittent failures when the next phase validates before the API server stabilizes.

🔧 Proposed fix to add stabilization waits to all phases

In testServiceAccountIssuerFirstIssuer:

 func testServiceAccountIssuerFirstIssuer(t testing.TB) {
 	kubeConfig, err := testlibrary.NewClientConfigForTest()
 	require.NoError(t, err)

 	kubeClient, err := clientcorev1.NewForConfig(kubeConfig)
 	require.NoError(t, err)

 	authConfigClient, err := configv1.NewForConfig(kubeConfig)
 	require.NoError(t, err)

 	setServiceAccountIssuer(t, authConfigClient, "https://first.foo.bar")
 	err = pollForOperandIssuer(t, kubeClient, []string{"https://first.foo.bar", "https://kubernetes.default.svc"})
 	require.NoError(t, err, "pollForOperandIssuer failed")
+	// Wait for API server to stabilize after configuration change
+	testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
 }

In testServiceAccountIssuerSecondIssuer:

 func testServiceAccountIssuerSecondIssuer(t testing.TB) {
 	kubeConfig, err := testlibrary.NewClientConfigForTest()
 	require.NoError(t, err)

 	kubeClient, err := clientcorev1.NewForConfig(kubeConfig)
 	require.NoError(t, err)

 	authConfigClient, err := configv1.NewForConfig(kubeConfig)
 	require.NoError(t, err)

 	setServiceAccountIssuer(t, authConfigClient, "https://second.foo.bar")
 	err = pollForOperandIssuer(t, kubeClient, []string{"https://second.foo.bar", "https://first.foo.bar", "https://kubernetes.default.svc"})
 	require.NoError(t, err, "pollForOperandIssuer failed")
+	// Wait for API server to stabilize after configuration change
+	testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
 }

Also applies to: 57-70

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between ac1bfe7 and aca76e9.

📒 Files selected for processing (2)
  • test/e2e/serviceaccountissuer.go
  • test/e2e/serviceaccountissuer_test.go
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • test/e2e/serviceaccountissuer.go
  • test/e2e/serviceaccountissuer_test.go
🧬 Code graph analysis (1)
test/e2e/serviceaccountissuer.go (1)
pkg/operator/operatorclient/interfaces.go (1)
  • TargetNamespace (7-7)
🔇 Additional comments (4)
test/e2e/serviceaccountissuer.go (3)

21-21: LGTM!

The import for testlibraryapi is correctly added to support the stabilization wait helper.


30-39: LGTM!

Good restructuring. Combining the three test phases into a single It block with By() steps provides a clear lifecycle narrative and ensures sequential execution. The [Timeout:30m] annotation appropriately accommodates the longer stabilization waits.


85-86: LGTM!

Correctly adds the stabilization wait after resetting to the default issuer.

test/e2e/serviceaccountissuer_test.go (1)

7-28: LGTM!

Good consolidation. The subtests correctly run sequentially (no t.Parallel()), maintaining the lifecycle dependency between phases. The comment clearly explains the temporary dual-framework situation and the three-phase lifecycle being tested.

@gangwgr
Copy link
Copy Markdown
Contributor Author

gangwgr commented Jan 12, 2026

/test e2e-aws-ovn

@wangke19
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jan 12, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gangwgr, wangke19

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@gangwgr
Copy link
Copy Markdown
Contributor Author

gangwgr commented Jan 12, 2026

/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 12, 2026
@gangwgr
Copy link
Copy Markdown
Contributor Author

gangwgr commented Jan 12, 2026

/verified by ci runs

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jan 12, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@gangwgr: This PR has been marked as verified by ci runs.

Details

In response to this:

/verified by ci runs

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD 1cdedef and 2 for PR HEAD aca76e9 in total

@gangwgr
Copy link
Copy Markdown
Contributor Author

gangwgr commented Jan 13, 2026

/test e2e-aws-ovn-serial-2of2

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Jan 13, 2026

@gangwgr: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit 29ee73d into openshift:main Jan 13, 2026
14 checks passed
err = pollForOperandIssuer(t, kubeClient, []string{"https://kubernetes.default.svc"})
require.NoError(t, err, "pollForOperandIssuer failed")
// Wait for API server to stabilize after configuration change
testlibraryapi.WaitForAPIServerToStabilizeOnTheSameRevision(t, kubeClient.Pods(operatorclient.TargetNamespace))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really required ? (it wasn't before)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is required, kas getting rollout after after config change which intermittently impacting other cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants